package com.dmjj.common.vo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * @author 张雪
 * @Description: TODO
 * @Title: ResultVO
 * @ProjectName dmjj-parent
 * @date 2018/12/24
 */
@Data
@EqualsAndHashCode(callSuper=false)
@ApiModel("返回结果VO")
public class ResultPageVO<T> {

    @ApiModelProperty("返回码")
    private Integer code;
    @ApiModelProperty("返回信息")
    private String message;
    @ApiModelProperty("当前页数")
    private Integer currentPage;
    @ApiModelProperty("总页数")
    private Integer totalPage;
    @ApiModelProperty("每页条数")
    private Integer numPerPage;
    @ApiModelProperty("总条数")
    private Integer totalCount;
    @ApiModelProperty("是否有下一页")
    private Boolean hasNext;
    @ApiModelProperty("返回的对象")
    private T dataList;


    public ResultPageVO(Integer code, String msg, T t){
        this.code=code;
        this.message = msg;
        if (t!=null){
            this.dataList = t;
        }
    }
    public ResultPageVO(Integer code, String msg, Integer currentPage, Integer totalPage, Integer numPerPage, Integer totalCount, Boolean hasNext, T t){
        this.code=code;
        this.message = msg;
        this.currentPage = currentPage;
        this.totalPage = totalPage;
        this.numPerPage = numPerPage;
        this.totalCount = totalCount;
        this.hasNext = hasNext;
        if (t!=null){
            this.dataList = t;
        }
    }
}
